package dominio.neuronio.teste;

import dominio.neuronio.Sinapse;
import dominio.neuronio.especializacao.NeuronioMcCullochPitts;
import dominio.padrao.Padrao;

public class TesteOr extends NeuronioMcCullochPitts {
	
	private static final double PESO = 0.2;
	private static final double BIAS = 0.2;
	
	public TesteOr() {
		super( BIAS );
	}
	
	@Override
	public void criarSinapses(Padrao padrao) {
		this.sinapses.clear();
		
		if ( padrao.getQtdeEstimulos() > 0 ) {
			
			double[] estimulos = padrao.getEstimulos();
			
			for( Double estimuloBruto : estimulos ) {
				this.sinapses.add( new Sinapse( estimuloBruto, PESO ) );
			}
		}
	}
	
	public static void main(String[] args) {
		
		int[][] matrix = new int[][]{
			{0,0},
			{0,1},
			{1,0},
			{1,1}
		};
		
		TesteOr testeOr = new TesteOr();
		
		for (int i = 0; i < matrix.length; i++) {
			int[] entradas = (int[]) matrix[i];
			double saida = testeOr.estimular( new Padrao(new double[]{entradas[0], entradas[1]}) );
			
			System.out.println("[" + entradas[0] + "," + entradas[1] + "] -> " + saida);
		}
		
	}

}
